/*
 * INSANE - Interactive Structural Analysis Environment
 *
 * Copyright (C) 2003-2005
 * Universidade Federal de Minas Gerais
 * Escola de Engenharia
 * Departamento de Engenharia de Estruturas
 * 
 * Author's email :    insane@dees.ufmg.br
 * Author's website :  http://www.dees.ufmg.br/insane
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
package br.ufmg.dees.insane.assembler;

import java.util.ArrayList;

import br.ufmg.dees.insane.model.femModel.Model;
import br.ufmg.dees.insane.model.femModel.node.Node;
import br.ufmg.dees.insane.util.IMatrix;
import br.ufmg.dees.insane.util.IVector;
import br.ufmg.dees.insane.util.LoadCombination;

/**
 * Class representing Assembler
 * @author roque
 * @since Jul 27, 2005
 */
public interface Assembler {
    
    /** Returns the Model of this Assembler.
     *@return The Model of this Assembler.
     */
    public abstract Model getModel();

    /** Sets the Model of this Assembler.
     *@param a The Model of this Assembler.
     */
    public abstract void setModel(Model a);

    /** Returns the size of the Xu vector.
     *@return The the size of the Xu vector.
     */
    public abstract int getSizeOfXu();

    /** Sets the size of the Xu vector.
     *@param a The size of the Xu vector.
     */
    public abstract void setSizeOfXu(int a);

    /** Returns the size of the Xu vector.
     *@return The the size of the Xu vector.
     */
    public abstract int getSizeOfXp();

    /** Sets the size of the Xp vector.
     *@param a The size of the Xp vector.
     */
    public abstract void setSizeOfXp(int a);
    
    /** Sets the value of isSingular variable.
     * @param a The value to be set.
     */
    public abstract void setSingular(boolean a);

    /** Returns the value of isSingular variable.
     * @return The value isSingular variable.
     */
    public abstract boolean isSingular();

    /** Returns the submatrix Cpu of this Assembler Model.
     *@return The submatrix Cpu of this Assembler Model.
     */
    public abstract IMatrix getCpu();

    /** Returns the submatrix Cup of this Assembler Model.
     *@return The submatrix Cup of this Assembler Model.
     */
    public abstract IMatrix getCup();

    /** Returns the submatrix Cpp of this Assembler Model.
     *@return The submatrix Cpp of this Assembler Model.
     */
    public abstract IMatrix getCpp();

    /** Returns the reduced matrix Cuu of this Assembler Model.
     *@return The reduced matrix Cuu of this Assembler Model.
     */
    public abstract IMatrix getCuu();
    
    /** Sets the specified State Variables to their Nodes.<p>
     * The data in input vector must be stored in the same order of equations.<br>
     *Ex.: Xu[0] is related to equation 1.
     *@param Xu A IVector containing the state variables.
     */
    public abstract void setXu(IVector Xu);

    /** Returns the Xu of this Assembler Model.<p>
     * The data is stored in the same order of equations.<br>
     *Ex.: Xu[0] is related to equation 1.
     *@return The Xu of this Assembler Model.
     */
    public abstract IVector getXu();
    
    /** Adds the value os the prescribed X to the calculated ones.*/
    public abstract void setXp();

    /** Returns the Xp of this Assembler Model.<p>
     * The data is stored in the same order of equations.<br>
     *Ex.: Xp[0] is related to equation -1.
     *@return the Xp of this Assembler Model.
     */
    public abstract IVector getXp();

    /** Returns the Np of this Assembler Model.<p>
     * The data is stored in the same order of equations.<br>
     *Ex.: Np[0] is related to equation 1.
     *@return The Np of this Assembler Model.
     */
    public abstract IVector getNp();
    
    /** Sets the specified Dual Variables to their Nodes.<p>
     * The data in input vector must be stored in the same order of equations.<br>
     *Ex.: Ru[0] is related to equation -1.
     *@param Ru A IVector containing the Dual Variables.
     */
    public abstract void setNu(IVector Ru);

    /** Returns the Ru of this Assembler Model.<p>
     * The data is stored in the same order of equations.<br>
     *Ex.: Ru[0] is related to equation -1.
     *@return The Ru of this Assembler Model.
     */
    public abstract IVector getNu();

    /** Returns the Ep of this Assembler Model.<p>
     * The data is stored in the same order of equations.<br>
     *Ex.: Ep[0] is related to equation 1.
     *@return The Ep of this Assembler Model.
     */
    public abstract IVector getEp();

    /** Returns the Eu vector necessary to calculate the Ru.
     *@return The Eu vector necessary to calculate the Ru.
     */
    public abstract IVector getEu();
    
    /** Returns the Fp of this Assembler Model.<p>
     *	The data is stored in the same order of equations.<br>
     *Ex.: Fp[0] is related to equation 1.
     *@return The Fp of this Assembler Model.
     */
    public abstract IVector getFp();
    
    /** Returns the submatrix Cpu of this Assembler Model.
     *@return The submatrix Cpu of this Assembler Model.
     */
    public abstract IMatrix getIncrementalCpu();

    /** Returns the submatrix Cup of this Assembler Model.
     *@return The submatrix Cup of this Assembler Model.
     */
    public abstract IMatrix getIncrementalCup();

    /** Returns the submatrix Cpp of this Assembler Model.
     *@return The submatrix Cpp of this Assembler Model.
     */
    public abstract IMatrix getIncrementalCpp();

    /** Returns the reduced matrix Cuu of this Assembler Model.
     *@return The reduced matrix Cuu of this Assembler Model.
     */
    public abstract IMatrix getIncrementalCuu();

    /** Returns the submatrix Cpu of this Assembler Model.
     *@return The submatrix Cpu of this Assembler Model.
     */
    public abstract IMatrix getTotalCpu();

    /** Returns the submatrix Cup of this Assembler Model.
     *@return The submatrix Cup of this Assembler Model.
     */
    public abstract IMatrix getTotalCup();

    /** Returns the submatrix Cpp of this Assembler Model.
     *@return The submatrix Cpp of this Assembler Model.
     */
    public abstract IMatrix getTotalCpp();

    /** Returns the reduced matrix Cuu of this Assembler Model.
     *@return The reduced matrix Cuu of this Assembler Model.
     */
    public abstract IMatrix getTotalCuu();
    
    /** Numbers the equations of the system.<p>
     *Positive numbers are related to possible state variables.<br>
     *Negative numbers are related to restraints to that state variables.<br>
     *Zero is related to invalid state variable to that type of AnalysisModel.
     */
    public abstract void numberEquations();

    /** Init the equations of the Nodes as zero.<p>
     */
    public abstract void initEquations();
    
    /** Init all variables of this Assembler.<p>
	*/
	public abstract void init();

    /** Numbers the equations of one Nodes.<p>
     *Positive numbers are related to possible state variables.<br>
     *Negative numbers are related to restraints to that state variables.<br>
     *Zero is related to invalid state variable to that type of AnalysisModel.
     */
    public abstract void numberEquations(Node node);

    /** Numbers the equations of the new Nodes List.<p>
     *Positive numbers are related to possible state variables.<br>
     *Negative numbers are related to restraints to that state variables.<br>
     *Zero is related to invalid state variable to that type of AnalysisModel.
     */
    public abstract void numberEquations(ArrayList nodesList);

    public void setLoading(LoadCombination lc);
    
    public void addLoading(LoadCombination lc);
    
    public void initLoading();

    /** Updates all variables of Model of this Assembler.
     */
    public abstract void update();
    
    /** Cleans all variables of Model of this Assembler.
     */
    public abstract void clean();
}